Skip to content

feat(gui): add Tauri desktop GUI (chat + sidebar pages) - #23

Closed
panuhorsmalahti wants to merge 5 commits into
mainfrom
worktree/add-gui
Closed

panuhorsmalahti wants to merge 5 commits into
mainfrom
worktree/add-gui

Conversation

@panuhorsmalahti

@panuhorsmalahti panuhorsmalahti commented Jun 5, 2026 •

Copy link
Copy Markdown
Collaborator
gui.mov

Summary

Adds a Rust/Tauri desktop GUI under gui/, alongside the existing cli/ TUI and web/ SPA. It's a third client for the agent-runtime, built up over a few commits:

  1. Empty Tauri 2 scaffold — React + TypeScript + Vite frontend (matches the web/ stack), trimmed to a blank window.
  2. Chat — connects to the runtime exactly like the CLI: a no-auth browser WebSocket to /api/ws (the runtime substitutes agent/user/thread server-side), history from /single-agent/messages, optimistic user messages, streamed chat replies, markdown rendering, and a tool-call inspector.
  3. Left sidebar — mirrors the web app's AppSidebar (logo header + nav), same lucide icons.
  4. Overview, Channels, Scheduled Tasks, Profile — ported from the web routes (index, channels, cron, profile), reading/writing the same no-auth /agents/* endpoints.

How it fits the repo

  • Standalone, not an npm workspace member. gui/ has its own toolchain (cargo) and package-lock.json, so it doesn't pull the Tauri CLI into the runtime's npm ci / Docker build. (Discussed and chosen deliberately over making it a workspace.)
  • Root dev:gui script (npm --prefix gui run tauri dev).
  • A path-filtered GUI Build CI workflow (.github/workflows/gui-build.yml) that builds the frontend + Rust shell on Linux when gui/** changes.
  • In dev, Vite proxies /single-agent, /agents, and /api/ws to :3003 so the webview stays same-origin (mirrors web/vite.config.ts).

Test plan

Ran the runtime (npm run dev, single-agent, Slack disabled) + the GUI Vite server, and exercised the exact proxied paths the GUI uses:

  • Chat (WebSocket via the :1420 proxy): connect → status {connected} → sent {type:'chat',payload:{mode:'followup',content}} → status {processing} → chat reply with role:AGENT. (Reply was a friendly Bedrock-auth error in my env, which still proves the full engine round-trip.)
  • History: GET /single-agent/messages → 200 [].
  • Overview / read endpoints (through the proxy): /agents/me, /agents/details, /agents/heartbeat/status, /agents/cron-tasks, /agents/slack/workspaces, /agents/slack-link-status, /agents/slack-channel-mappings all return the expected shapes.
  • Mutations (against the runtime):
    • Cron: POST /agents/cron-tasks → 201, DELETE /agents/cron-tasks/:id → {success:true}.
    • Profile: GET /agents/model, PATCH /agents/name, PATCH /agents/heartbeat/interval, POST /agents/heartbeat/trigger → all 200.
    • Channels: POST /agents/slack/create-verification-code → {code}, heartbeat-trigger POST (correct shape) + DELETE → {success:true}.
  • npm --prefix gui run build (tsc + vite) and npx oxlint gui/src both clean.
  • cargo build --locked (in gui/src-tauri) compiles the Rust shell.

Notes / limitations

  • Markdown profile fields (soul/user/memory/heartbeat/vision/agent/bootstrap) are read-only — matches the current web Profile (no save endpoint for them yet).
  • Profile Export is wired (download link); Restore/import is not (needs a file dialog + multipart + runtime restart).
  • Plain-CSS ports — structurally faithful to the web pages, but not pixel-identical to its shadcn/LDS styling.
  • Dev loop is verified via tauri dev (Vite proxy). A packaged tauri build would need VITE_RUNTIME_URL + CORS (or the Tauri HTTP/WS plugins); noted in gui/README.md.

Scaffold a Rust/Tauri 2 desktop app under gui/ with a React + TypeScript +
Vite frontend, matching the web/ stack. Stripped the scaffold's demo greet
command and logo UI down to a single empty window.

Kept gui standalone (not an npm workspace member) so it doesn't couple the
Tauri toolchain into the runtime's npm ci / Docker build. Added a root
dev:gui script (npm --prefix gui) and a path-filtered GUI Build CI workflow
that compiles the frontend and Rust shell on Linux.

Signed-off-by: Panu Horsmalahti <phorsmalahti@mirantis.com>
Wire the desktop GUI to the agent-runtime's chat the same way the cli/ TUI
and web/ SPA do: a no-auth browser WebSocket to /api/ws (runtime substitutes
agent/user/thread server-side), recent history from /single-agent/messages,
and per-step chat replies appended as they arrive. User messages render
optimistically since the runtime only broadcasts AGENT messages back.

- lib/ws-client.ts: browser WebSocket with reconnect/backoff, outbound
  buffering, and ping/heartbeat -> pong (port of the cli ws-client).
- lib/runtime.ts: same-origin URL helpers (override via VITE_RUNTIME_URL),
  history fetch, message coercion.
- hooks/use-chat.ts: connection + message + status state.
- components/: message list, markdown rendering, tool-call inspector, input.
- vite.config.ts: proxy /single-agent, /agents, /api/ws to :3003 so the
  webview stays same-origin in dev (mirrors web/vite.config.ts).

Signed-off-by: Panu Horsmalahti <phorsmalahti@mirantis.com>
Mirror the web app's AppSidebar: a 16rem left panel with the Prism logo
header and a nav list, for now just a single active Chat item using the
same lucide MessageSquare icon. App.tsx becomes a shell (sidebar + main),
with view state ready for more links. Reuses web's prism-logo.svg.

Signed-off-by: Panu Horsmalahti <phorsmalahti@mirantis.com>
Add an Overview/home view mirroring web/src/routes/index.tsx: agent name
with type + status badges, a Chat button, four stat cards (Heartbeat,
Channels, Scheduled Tasks, Created), and the Welcome onboarding card with
action tiles. Reads the same no-auth /agents/* endpoints as the web app
(me, details, heartbeat/status, cron-tasks, slack workspaces/mappings) via
a small useApi hook and apiGet helper; format helpers copied from web.

Overview is now the default view and the sidebar's first nav item
(LayoutDashboard icon). Stat cards and tiles whose web counterparts link to
pages the GUI lacks yet (profile/channels/cron) render as read-only for now;
the Chat button and 'Start a conversation' tile switch to the Chat view.

Signed-off-by: Panu Horsmalahti <phorsmalahti@mirantis.com>
Port the remaining sidebar pages from the web app, completing the nav
(Overview, Chat, Channels, Scheduled Tasks, Profile):

- Channels: Slack workspace, Personal (DM) + Team (channel) linking via
  verification codes with polling, and heartbeat-trigger CRUD.
- Scheduled Tasks: cron task list with create/delete.
- Profile: editable name + model, read-only markdown tabs (soul/user/
  memory/heartbeat/vision/agent/bootstrap), heartbeat status panel
  (start/stop/trigger + interval editor), and backup export link.

Shared infra: apiPost/apiPatch/apiDelete helpers, useApi refetch, and
generic Modal + ConfirmDialog components. Overview stat cards and welcome
tiles now navigate to the corresponding pages.

All endpoints are the same no-auth /agents/* routes the web app uses,
reached through the Vite proxy.

Signed-off-by: Panu Horsmalahti <phorsmalahti@mirantis.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant